import {highlightsUtils} from './highlightsUtils.js'


export class highlightsTools
{
    constructor(page)
    {
        this.page = page;
        this.utils = highlightsUtils
    }

    async highlightElements(elements)
    {
        await this.page.ref.evaluate(({createLayerStr, highlightElementsStr, numberInCornerStr, elements}) =>
        {
            const createLayer = eval(createLayerStr) ;
            const highlightElements = eval(highlightElementsStr) ;
            const numberInCorner = eval(numberInCornerStr) ;
            createLayer() ;
            highlightElements(elements, numberInCorner) ;
        },
        {
            createLayerStr: this.utils.getCreateHighlightLayerFunctionString(),
            highlightElementsStr: this.utils.getHighlightElementFunctionString(),
            numberInCornerStr: this.utils.getCreateNumberInCornerFunctionString(),
            elements: elements
        });
    }
}